package com.ruicar.afs.cloud.common.mq.rabbit.config.rabbit;

import lombok.Data;
import lombok.ToString;
import org.springframework.util.StringUtils;

@Data
@ToString
public class RabbitMqConfig {
    private String host;
    private int port;
    private String clusterAddressesList;
    private String username;
    private String password;
    private String virtualHost = "/";
    private int prefetch = 5;
    private String templateName;
    private String listenerName;
    boolean enable = true;
    public String getTemplateName(String key) {
        return StringUtils.isEmpty(templateName) ? (key + "-afs-rabbit-template") : templateName;
    }

    public String getListenerName(String key) {
        return StringUtils.isEmpty(listenerName) ? (key + "-afs-rabbit-listener") : listenerName;
    }
}
